﻿using System;
using System.Collections.Generic;
using System.Linq;

namespace NTTDATA.BEENChina.ResultCertification.Checker
{
    public class Verfity0302 : VerfityMulitResult
    {
        public override bool CheckResult(List<List<string>> result1, string entryCommon1, List<List<string>> result2, string entryCommon2)
        {
            List<string[]> r1 = result1.SelectMany(o => o.Select(p => p.Split(new char[] { '/' }))).ToList();
            List<string[]> r2 = result2.SelectMany(o => o.Select(p => p.Split(new char[] { '/' }))).ToList();

            for (int i = 0; i < r1.Count() && i < r2.Count(); i++)
            {
                for (int j = 0; j < r1[i].Count() && j < r2[i].Count(); j++)
                {
                    if (r1[i][j].Contains("?") || r2[i][j].Contains("?"))
                    {
                        continue;
                    }

                    if(check( r1[i][j], r2[i][j]))
                    {
                        return true;
                    }
                }
            }
            return false;
        }

        private bool check(string result1, string result2)
        {
            if( result1== null  || result2==null)
            {
                return false ;
            }
            
            int strLenDiff = Math.Abs(result1.Length - result2.Length);
            if (strLenDiff == 0)
            {
                return false;
            }

            Console.WriteLine(result1);
            Console.WriteLine(result2);


            //位数不一致 抽出
            return true;
            //int compareLen = NTTDATA.BEENChina.ResultCertification.Util.CompareString.GetLeaveOutCount(result1, result2);
            //return strLenDiff == compareLen;
        }     
    }
}